home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
c_lang
/
varinc.lzh
/
PAGE52.C
< prev
next >
Wrap
C/C++ Source or Header
|
1979-11-30
|
2KB
|
38 lines
/* Prompt for command; then call appropriate function to do it. */
main()
{
short command;
int rtn;
do /* Loop until quit command given. */
{
printf("CUSTOMER DATA MANAGEMENT MENU\n\n");
printf("1. List\n2. Add\n3. Change\n4. Quit\n\t#: ");
rtn = scanf("%hd", &command);
if (rtn == 0)
command = 0; /* unknown command */
else if (rtn != 1) /* End of file reached. */
command = 4; /* Quit. */
switch (command)
{ /* Begin switch statement body. */
case 1: /* List. */
list_cust(); /* Call list_cust function. */
break; /* Don't allow add_cust call after list. */
case 2: /* Add. */
add_cust();
break;
case 3: /* Change. */
change_cust();
break;
case 4: /* Quit. */
break; /* Do nothing in this case. */
default: /* Bad command; ring bell. */
printf("Unknown command: %d\7\n", command);
break; /* Here to prevent problems if new cases */
/* are added later. */
} /* end switch statement body */
} /* end do...while loop body */
while (command != 4); /* Repeat if not quitting time. */
} /* end of main() function */